package com.spring.aop.interceptor;

import com.spring.aop.Advisor;
import com.spring.aop.InterceptorChain;

import java.lang.reflect.Method;

public class BeforeInterceptor extends Interceptor {
	public BeforeInterceptor(Advisor advisor) {
		super(advisor);
	}
	
	@Override
	public Object invoke(InterceptorChain chain, Object targetObject, Method targetMethod, Object[] args) throws Throwable {
		// 调用前置通知
		advisor.before();
		return chain.proceed(targetObject, targetMethod, args);
	}
}
